package com.tinyseed.emcp.api.basicdata.domain;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;

/**
 * tb_workshop
 *
 * @author tinyCode
 * @date 2019-11-22 21:37:54
 */
@Data
@Table(name = "tb_workshop")
@Entity()
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonIgnoreProperties(value = {"hibernateLazyInitializer", "handler"})
public class Workshop implements Serializable {

    /**
     * 主键
     */
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO	, generator = "myid")
    @GenericGenerator(name = "myid", strategy = "com.tinyseed.emcp.api.app.common.ManulInsertGenerator")
    private Long id;
    /**
     * 车间名称
     */
    @Column(nullable = true)
    private String shopName;
    /**
     * 企业id
     */
    @Column(nullable = true)
    private Long enterpriseId;
    /**
     * 备注
     */
    @Column(nullable = true)
    private String remark;
    /**
     * 创建时间
     */
    @Column(nullable = true)
    private Timestamp createTime;
    /**
     * 最后修改时间
     */
    @Column(nullable = true)
    private Timestamp modifyTime;
    /**
     * 创建人
     */
    @Column(nullable = true)
    private String creator;
    /**
     * 最后操作人
     */
    @Column(nullable = true)
    private String modifier;

    @ManyToOne(optional = true, fetch = FetchType.LAZY)
    @JoinColumn(name = "enterpriseId", referencedColumnName = "id", insertable = false, updatable = false)
    private Enterprise enterprise;
}
